<?php
namespace Hive\Job\Contract;
/**
 * Contract Type,
 * 
 * It represent a type of contract for a mission or an job experience
 *
 * @author Xavier VILAIN
 * @package Hive\Job\Contract
 *
 * @property string	$type			Id of the type
 * @property string	$language		Language
 * @property string	$label			Label 
 * @property string	$group			Grouping field
 * @property bool	$standard		Is a standard type (can't be deleted)
 * 
 */
class Type  extends \Fox\Object\Customizing {

	/**
	 * Find Type label
	 * @param string $type
	 * @return string
	 */
	static public function labelize($type) {
		try {
			return \Fox\Dao::load(self::className(),$type)->label();
		}
		catch(Fox\Object\Exception\NotExist $e) {
			return null;
		}
	}
}
\Fox\Dao::infos(
	Type::className(),
	new \Fox\Object\Info('job_contract_types', \Fox\Databases::DB_APP)
);
//\Fox\Dao::useZone(Type::className(),new \Fox\Dao\DiskTimeCacheZone(\Fox\Dao\DiskTimeCacheZone::PERIOD_FOREVER,Type::cacheDirectory()));
// Link to i18n elements
\Fox\Object\Links::add(\Fox\Dao::link(Type\I18n::className(),Type\I18n::LINK_REFERENCE)
->to(Type::className(), Type::LINK_I18N)
->on('type')
//->cache(new \Fox\Dao\MemoryCacheZone(\Fox\Dao\MemoryCacheZone::PERIOD_FOREVER,Type::cacheDirectory()))
->versionFrom());